package com.example.time;

import java.time.LocalDate;
import java.time.Period;

public class DateTest2 {
    public static void main(String[] args) {
        LocalDate localDate1 = LocalDate.of(2017, 9, 1);

        LocalDate localDate2 = LocalDate.of(2017, 10, 2);

        System.out.println(localDate1.toEpochDay());
        //错误写法，隔月时月份单独计算
        Period next = Period.between(localDate1, localDate2);

        System.out.println("相隔多少天：" + next.getDays());

        System.out.println(LocalDate.of(2022, 4, 19).toEpochDay()
                - LocalDate.of(2022, 4, 18).toEpochDay());

        int i=0;
        while(true){

            System.out.println(++i);
            if(i > 10){
                break;
            }
        }
    }
}
